<?php

class Application_Form_Category extends Zend_Form {
    
    public function init() {
        $this->setName('Category');
        
        $category_id = new Zend_Form_Element_Hidden('category_id');
            
        $category_image = new Zend_Form_Element_File('category_image');
        $category_image->setLabel('Hình ảnh :')
                      ->setDestination(ROOT_PUBLIC_MEDIA_UPLOAD_USERIMAGE);
        $category_image->addValidator('Count', false, 1); // only one file
        $category_image->addValidator('Size', false, 1024000); //500Kb
        $category_image->addValidator('Extension', false, 'jpg,png,gif'); // file extention
                
        $category_name = new Zend_Form_Element_Text('category_name');
                $category_name->setLabel('Tên category :')
                        ->setRequired(true);
                
        $parent_id = new Zend_Form_Element_Select('parent_id');
                $parent_id->setLabel('Parent id :')
                        ->setRequired(true);
                
        $sort_order = new Zend_Form_Element_Text('sort_order');
                $sort_order->setLabel('Sắp xếp:');  
     
               
        $btn_submit = new Zend_Form_Element_Submit('submit');
        $btn_submit->setAttrib('id', 'submit');
        $btn_submit->setlabel('Đồng ý');

        $btn_cancel = new Zend_Form_Element_Submit('cancel');
        $btn_cancel->setAttrib('id', 'cancel');
        $btn_cancel->setLabel('Hủy bỏ');
        
        $this->addElements(array($category_image, $category_name, $parent_id, $sort_order, $category_id, $btn_submit, $btn_cancel
        ));
    }
}